package dispatcher;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import utils.MyBase64;

public class MenuPolls extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		super.doPost(req, resp);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession(true);
		Object userID = session.getAttribute("userID");
		if (userID == null
				|| userID.toString().trim().length() == 0) {
			response.sendRedirect("./login?option="
					+ MyBase64.encode(Login.NO_SESSION.getBytes()));
		}
		else
		{
			RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("menuPolls.jsp");
			dispatcher.forward(request, response);
		}
	}
}